package com.jbxie.spaceiotmqtt.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.ninwoo.bishe.starter.service.NetworkService;

import java.util.List;

@Service
public class IPService {

    @Autowired
    private NetworkService networkService;

    public String getIpByAppName(String appName) {
        List<String> ipList = networkService.getIpListByAppName(11111l, appName);
        if (!ipList.isEmpty()) {
            String ip_tmp = ipList.get(0);
            String[] split_list = ip_tmp.split("/");
            return split_list[0];
        }
        return null;
    }
}
